package test;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.util.Random;

/**
 * @program: util
 * @description: 模拟生成2亿条数据
 * @author: zhouliangliang
 * @create: 2021-05-19 19:54
 **/
public class MovieFileGen {
    public static void main(String[] args) throws Exception{
        Random random = new Random();
        File file = new File("/Users/zhouliangliang/shells/movies");
        if (file.exists()) {
            file.delete();
        }
        if(!file.exists()) {
            file.createNewFile();
        }

        for(int i=1; i<=200000000; i++) {
            int value = Math.abs(random.nextInt(100)) % 100;
            int users = Math.abs(random.nextInt(1000)) % 1000;
            FileUtils.write(file, "movie" + value + " " + users + "\n",true);
        }
    }
}
